<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>

    // let 对象名= {}
    let obj = {
      name: '张三',
      age: 18,
      gender: '男',
      'user-name': '李四'
    }
    // let name = '张三'
    // let age = 18
    // let gender = '男'


    //查对象
    //打印对象  对象名.属性名
    console.log(obj)
    // console.log(obj.age)
    // console.log(obj.gender)
    // console.log(obj.name)

    //改对象
    // obj.gender = '女'
    // console.log(obj.gender)
    // console.log(obj)

    //增对象
    // obj.name2 = '王五'
    // console.log(obj)
    // console.log(obj.name2)

    //删对象
    // delete obj.age
    // console.log(obj)
    // console.log(obj.age)

    //查的第二种写法  对象名['属性名']
    // console.log(obj.user - name)
    // console.log(obj['user-name'])
    // console.log(obj['name'])


  </script>
</body>

</html>